import { createSSRApp } from 'vue'
import App from './App.vue'
import * as Pinia from 'pinia'
import uView from '@/uni_modules/uview-ui'
import { useUserStore } from '@/stores/user'

export function createApp() {
  const app = createSSRApp(App)
  
  // 创建Pinia实例
  const pinia = Pinia.createPinia()
  app.use(pinia)
  
  // 使用uView UI
  app.use(uView)
  
  // 初始化用户状态
  const userStore = useUserStore()
  userStore.initUserState()
  
  return {
    app,
    Pinia
  }
}